package com.example.netlib;

import android.app.Application;

import com.example.netlib.loading.single.SingleDialogLoadingAction;
import com.example.netlib.netwrapper.LocalHttpClientHolder;
import com.example.netlib.netwrapper.NetHttpClientHolder;
import com.szlanyou.thirdsdk.retrofit.loading.helper.AppSingleDialogLoadingHelper;

/**
 * @author 陈章
 * create at 2021/7/8 9:59
 * desc:
 */
public class MyApplication extends Application {
    @Override
    public void onCreate() {
        super.onCreate();
        LocalHttpClientHolder.getInstance().init(this,true);
        NetHttpClientHolder.getInstance().init(this,true);

        //绑定单例的Loading
        AppSingleDialogLoadingHelper.getInstance().bind(new SingleDialogLoadingAction(this));
        //注入网络客户端
        AppSingleDialogLoadingHelper.getInstance().registerHttpClient( LocalHttpClientHolder.getInstance().getHttpClient());
        AppSingleDialogLoadingHelper.getInstance().registerHttpClient( NetHttpClientHolder.getInstance().getHttpClient());
        //将单例Loading注入网络客户端
        AppSingleDialogLoadingHelper.getInstance().rejectLoadingForClients();

    }
}
